pub mod component;
pub mod core;

use std::env;
use crate::core::Executor;
use crate::core::build::Build;
use crate::core::check::Check;

const VERSION: &str = "0.0.1";

#[async_std::main]
async fn main() {
    println!("
    Perfect Rust
        --v{}

    The Faster Rust Grammar
        by:Squbirreland
    ", VERSION);
    let mut args: Vec<String> = env::args().collect();
    args.remove(0);
    if !args.is_empty() {
        let mut exec: Box<dyn Executor> = match args[0].as_str() {
            "build" => { Box::new(Build::default()) }
            "check" => { Box::new(Check::default()) }
            _ => { return; }
        };
        args.remove(0);
        exec.execute(env::current_dir().unwrap(), args);
    }
}
